﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IniParser;
using IniParser.Model;

namespace WinFormsApp1
{
    public class Configure
    {
        private string iniPath;
        public Configure() { }
        public Configure(string ini)
        {
            IniPath = ini;
        }

        public string IniPath
        {
            get
            {
                return iniPath;
            }
            set
            {
                iniPath = value;
            }
        }

        public IniData iniData()
        {
            IniData data = null;
            if (File.Exists(iniPath))
            {
                var parse = new FileIniDataParser();
                data = parse.ReadFile(iniPath);
            }
            return data;

        }

        public string GetValue(string select, string key) {
            IniData data = null;
            string resu = "";
            if (File.Exists(iniPath))
            {
                var parse = new FileIniDataParser();
                data = parse.ReadFile(iniPath);
            }
            if (data != null)
            {
                KeyDataCollection keyCols = data[select];
                resu = keyCols[key];
            }
            return resu;
        }


    }

}
